home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 7_7.lha / 7_7 / tst.c < prev    next >
Text File  |  1993-08-08  |  961b  |  42 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. include "7_6a.h"
  6. include "7_7_dlink.h"
  7. include "7_7.h"
  8. include "7_7dlist.h"
  9.  
  10. include <stream.h>
  11.  
  12. ain()
  13.  
  14.    dlist odlist;
  15.    dlist_iterator xdlist(odlist);
  16.    xdlist.append("hello");
  17.    xdlist.append("there");
  18.    xdlist.append("how");
  19.    xdlist.append("are");
  20.    xdlist.append("you");
  21.    xdlist.append("today");
  22.    void *x;
  23.    cout << "forwards\n";
  24.    while (xdlist.next(x))
  25. cout << "'" << (char*)x << "'\n";
  26.    cout << "\nbackwards\n";
  27.    while (xdlist.prev(x))
  28. cout << "'" << (char*)x << "'\n";
  29.    xdlist.next(x);
  30.    xdlist.next(x);
  31.    xdlist.inserthere("Beep");
  32.    xdlist.appendhere("Boop");
  33.    xdlist.reset();
  34.    cout << "\nforwards, removing\n";
  35.    while (xdlist.getnext(x))
  36. cout << "'" << (char*)x << "'\n";
  37.    cout << "\nbackwards\n";
  38.    while (xdlist.getprev(x))
  39. cout << "'" << (char*)x << "'\n";
  40.    return 0;
  41.  
  42.